/*
 * Created by JFormDesigner on Fri May 31 18:25:00 EDT 2013
 */

package MaintMenu;

import CreateNewItem.CreateNewItem;
import MaintMenu.PoAnalysis.Poa;
import MaintMenu.Shipinfo1.Shipinfo1;
import MaintMenu.SyncInventoryToCat.SyncInventoryToCat;
import MaintMenu.VenPricingUpdMasterFiles.VendorPricingUpdateMasterFiles;
import MaintMenu.VenPricingUpdTBLN.*;


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author Jason Chi
 */
public class MaintMenu extends JFrame {

    public MaintMenu() {

        initComponents();
    }

    private void venPricingUpdateActionPerformed(ActionEvent e) {
        VendorPricingUpdateMasterFiles applet = new VendorPricingUpdateMasterFiles();
        JFrame frame = new JFrame();
        frame.setSize(500, 600);
//        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Update Parts Link Number");
        frame.getContentPane().add(applet, BorderLayout.CENTER);
//        applet.init();
//        applet.start();
        frame.setLocationRelativeTo(null); // Center the frame
        frame.setVisible(true);
        frame.repaint();
        applet.repaint();




    }

    private void syncPLActionPerformed(ActionEvent e) {
        SyncInventoryToCat appletSync = new SyncInventoryToCat();
        JFrame frameSync = new JFrame();
        frameSync.setSize(500, 600);
//        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frameSync.setTitle("Sync INV and CAT by PL");
        frameSync.getContentPane().add(appletSync, BorderLayout.CENTER);
////        applet.init();
////        applet.start();
        frameSync.setLocationRelativeTo(null); // Center the frame
        frameSync.setVisible(true);
        frameSync.repaint();
        appletSync.repaint();



    }

    private void shipinfo1ActionPerformed(ActionEvent e) {
        Shipinfo1 appletShipinfo1 = new Shipinfo1();
//        JFrame frameSync = new JFrame();
//        frameSync.setSize(500, 175);
//        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//        frameSync.setTitle("Sync INV and CAT by PL");
//        frameSync.getContentPane().add(appletSync, BorderLayout.CENTER);
////        applet.init();
////        applet.start();
//        frameSync.setLocationRelativeTo(null); // Center the frame
//        frameSync.setVisible(true);
//        frameSync.repaint();
        appletShipinfo1.repaint();
        appletShipinfo1.setVisible(true);
        appletShipinfo1.repaint();

    }

    private void CreateNewItemActionPerformed(ActionEvent e) {
        CreateNewItem newItem = new CreateNewItem();
        newItem.setVisible(true);
    }


    public void minFrame(){
        this.setState(Frame.ICONIFIED);
    }

    public void resFrame(){
        this.setState(Frame.NORMAL);
    }

    private void poaActionPerformed(ActionEvent e) {
        Poa poAnalysisMenu = new Poa();
        poAnalysisMenu.repaint();
        poAnalysisMenu.setVisible(true);
        poAnalysisMenu.repaint();
    }

    private void venPriceUpdTBLActionPerformed(ActionEvent e) {
//        VendorPricingUpdateTBLN vendorPricingUpdateTBLN = new VendorPricingUpdateTBLN();
//        vendorPricingUpdateTBLN.repaint();
//        vendorPricingUpdateTBLN.setVisible(true);
//        vendorPricingUpdateTBLN.repaint();

        //0 = PL ,  1 = DNKPART#
        APtbl ap= new APtbl(0);
        //System.out.println("\nAP Complete\n");
        YCCtbl ycc= new YCCtbl(0);
        //System.out.println("\nYCC Complete\n");
        TYGtwtbl tyGtw = new TYGtwtbl(0);
        TYGtwtbl tyGtw1 = new TYGtwtbl(1);
        //System.out.println("\nTW Complete\n");
        TYGtxtbl tyGtx = new TYGtxtbl(0);
        TYGtxtbl tyGtx1 = new TYGtxtbl(1);
        //System.out.println("\nTX Complete\n");
        GENERAtbl gen = new GENERAtbl(1);
        //System.out.println("\nGN Complete\n");
        DEPOtbl depo1 = new DEPOtbl(0);
        //System.out.println("\nDP Complete\n");
        JOptionPane.showMessageDialog(null,"Execute Complete");


//        testTBL testTBL = new testTBL();

        JOptionPane.showMessageDialog(null,"Execute Complete");

    }

    private void button1ActionPerformed(ActionEvent e) {
//        String a="TW";
//        String b="AU3010128";
//        int c=5;

//        System.out.println(a + b + c);


//        FindItemByVendorSheetPL findItemByVendorSheetPL = new FindItemByVendorSheetPL(a,b,c);

    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner Evaluation license - jason Chi
        label1 = new JLabel();
        syncPL = new JButton();
        shipinfo1 = new JButton();
        label2 = new JLabel();
        venPricingUpdate = new JButton();
        label3 = new JLabel();
        venPriceUpdTBL = new JButton();
        label4 = new JLabel();
        poa = new JButton();
        CreateNewItem = new JButton();
        button1 = new JButton();
        panel1 = new JPanel();

        //======== this ========
        setIconImage(new ImageIcon(getClass().getResource("/images/greenarrow.jpg")).getImage());
        Container contentPane = getContentPane();
        contentPane.setLayout(new GridBagLayout());
        ((GridBagLayout)contentPane.getLayout()).columnWidths = new int[] {44, 28, 162, 21, 0};
        ((GridBagLayout)contentPane.getLayout()).rowHeights = new int[] {18, 0, 39, 0, 39, 0, 0, 0, 0, 0, 0, 0};
        ((GridBagLayout)contentPane.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4};
        ((GridBagLayout)contentPane.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};

        //---- label1 ----
        label1.setText("MAINT");
        label1.setHorizontalAlignment(SwingConstants.CENTER);
        label1.setHorizontalTextPosition(SwingConstants.CENTER);
        contentPane.add(label1, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- syncPL ----
        syncPL.setText("Sync PL# Between 6CAT & INV");
        syncPL.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                syncPLActionPerformed(e);
            }
        });
        contentPane.add(syncPL, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- shipinfo1 ----
        shipinfo1.setText("Shipinfo1");
        shipinfo1.setForeground(new Color(0, 102, 51));
        shipinfo1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                shipinfo1ActionPerformed(e);
            }
        });
        contentPane.add(shipinfo1, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- label2 ----
        label2.setText("Operation after PO posting");
        contentPane.add(label2, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- venPricingUpdate ----
        venPricingUpdate.setText("Vendor Pricing Update MAS");
        venPricingUpdate.setForeground(new Color(0, 102, 51));
        venPricingUpdate.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                venPricingUpdateActionPerformed(e);
            }
        });
        contentPane.add(venPricingUpdate, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- label3 ----
        label3.setText("Update Master files with Vendor Cost");
        contentPane.add(label3, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- venPriceUpdTBL ----
        venPriceUpdTBL.setText("Vendor Price Update TBL");
        venPriceUpdTBL.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                venPriceUpdTBLActionPerformed(e);
            }
        });
        contentPane.add(venPriceUpdTBL, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- label4 ----
        label4.setText("Update TBL files with vendor Cost");
        contentPane.add(label4, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- poa ----
        poa.setText("PO Analysis (3 Days)");
        poa.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                poaActionPerformed(e);
            }
        });
        contentPane.add(poa, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- CreateNewItem ----
        CreateNewItem.setText("Create New Item");
        CreateNewItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                CreateNewItemActionPerformed(e);
            }
        });
        contentPane.add(CreateNewItem, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //---- button1 ----
        button1.setText("temp");
        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button1ActionPerformed(e);
            }
        });
        contentPane.add(button1, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));

        //======== panel1 ========
        {

            // JFormDesigner evaluation mark
            panel1.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                    "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                    javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
                    java.awt.Color.red), panel1.getBorder())); panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

            panel1.setLayout(new GridBagLayout());
            ((GridBagLayout)panel1.getLayout()).columnWidths = new int[] {387, 0};
            ((GridBagLayout)panel1.getLayout()).rowHeights = new int[] {276, 0};
            ((GridBagLayout)panel1.getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
            ((GridBagLayout)panel1.getLayout()).rowWeights = new double[] {0.0, 1.0E-4};
        }
        contentPane.add(panel1, new GridBagConstraints(0, 10, 4, 1, 0.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0), 0, 0));
        setSize(440, 580);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    // Generated using JFormDesigner Evaluation license - jason Chi
    private JLabel label1;
    private JButton syncPL;
    private JButton shipinfo1;
    private JLabel label2;
    private JButton venPricingUpdate;
    private JLabel label3;
    private JButton venPriceUpdTBL;
    private JLabel label4;
    private JButton poa;
    private JButton CreateNewItem;
    private JButton button1;
    private JPanel panel1;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}
